#!/usr/bin/env python

class Graph:
    def __init__(self):
        self.graph = []
        self.nodes = 0
    
    def __len__(self):
        return self.nodes
        
    def AddNode(self):
        self.nodes = self.nodes + 1
        if self.nodes == 1:
            self.graph.append([0])
        else:
            for line in self.graph:
                line.append(0)
            T = []
            for i in range(0, self.nodes):
                T.append(0)
            self.graph.append(T)
    
    def SetCost(self, x, y, w):
        self.graph[x][y] = w
        
    def ReadFile(self, fname):
        pass
        
    def PrintGraph(self):
        for line in self.graph:
            print line
            
            
if __name__ == "__main__":
    g = Graph()
    g.AddNode()
    g.AddNode()
    g.AddNode()
    g.AddNode()
    g.PrintGraph()
